﻿<%@ Page Title="Danh sách Video" Language="C#" AutoEventWireup="true" CodeBehind="VideoList.aspx.cs" Inherits="VIT.Web.Admin.VideoList" %>
<%@ Register Assembly="VIT.Web.Controls" Namespace="VIT.Web.Controls" TagPrefix="VIT" %>

<asp:Content ID="HeadContent" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="<%=URLRoot %>Admin/Includes/VIT.js"></script>
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <form id="aspnetForm" runat="server">

        <div>
            <div class="select">
                Ngôn ngữ: <asp:DropDownList ID="ddlLang" runat="server" autopostback="true" onselectedindexchanged="ddlLang_SelectedIndexChanged"></asp:DropDownList>
                &nbsp;
                Album:
                <select id="parentid" name="parentid">
                    <option value="0"> -- None -- </option>
                    <%=this.genOption%>
                </select>
            </div>
            <div class="toolbar">
                <asp:Button ID="Filter" runat="server" ToolTip="Lọc dữ liệu" CssClass="icon-32-filter" BorderStyle="None" style="margin:10px" OnClick="Filter_Click"/>
                <VIT:Submit ID="Insert" runat="server" Function="Video_Insert" ToolTip="Thêm" CssClass="icon-32-add" BorderStyle="None" OnClick="Insert_Click"/>
                <VIT:Submit ID="Published" runat="server" Function="Video_Modify" ToolTip="Bật" CssClass="icon-32-apply" BorderStyle="None" OnClick="Published_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn Video để bật.');"/>
                <VIT:Submit ID="UnPublished" runat="server" Function="Video_Modify" ToolTip="Tắt" CssClass="icon-32-unapply" BorderStyle="None" OnClick="UnPublished_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn Video để tắt.');"/>
                <VIT:Submit ID="Delete" runat="server" Function="Video_Delete" ToolTip="Xóa" CssClass="icon-32-delete" BorderStyle="None" OnClick="Delete_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn danh mục để xóa.')  && confirm('Xóa Video được chọn');"/>
            </div>
        </div>
        <div class="clr"></div>

        <div>
            <table>
                <asp:ObjectDataSource ID="ODS" runat="server" SortParameterName="SortColumn" SelectMethod="GetData" TypeName="VIT.Web.Admin.VideoList"
                    onselecting="odsProducts_Selecting">  
                    <SelectParameters>  
                       <asp:Parameter Name="selectedId" Type="String" />  
                    </SelectParameters>                 
                </asp:ObjectDataSource>
                <asp:ListView ID="ListView" runat="server" DataSourceID="ODS">
                    <LayoutTemplate>
                        <thead>
	                        <tr>
                                <th width="2%">#</th>
		                        <th width="2%">
			                        <input type="checkbox" name="toggle" id="toggle" onclick="checkAll('toggle', 'itemCheckbox')"/>
	                            </th>          
	                            <th width="100px">Hình đại diện</th>          
		                        <th width="20%">
                                    <asp:LinkButton ID="lnkTitle" runat="server" CommandName="Sort" CommandArgument="Title" Text="Tiêu đề" />
                                </th>
		                        <th width="10%">Album</th>
		                        <th>Mô tả</th>
                                <th width="10%">
                                    <asp:LinkButton ID="lnkOrders" runat="server" CommandName="Sort" CommandArgument="Orders" Text="Thứ tự" />
                                </th>
		                        <th width="10%">
                                    <asp:LinkButton ID="lnkPublished" runat="server" CommandName="Sort" CommandArgument="Published" Text="Hiển thị" />
                                </th>
                                <th>ID</th>
		                        <th width="5%">Sửa</th>
	                        </tr>			
                        </thead>
                        <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
                    </LayoutTemplate>
                        
                    <ItemTemplate>
                        <tr class="row<%#Container.DataItemIndex%2 %>">
		                    <td align="center"><%#Container.DataItemIndex%></td>
	                        <td align="center">
		                        <input type="checkbox" name="itemCheckbox" value="<%#Eval("Id")%>" />
                            </td>
                            <td align="center"><img src='../../../Uploads/Videos/Thumbs/<%#Eval("Image")%>' width="80px"/></td>
	                        <td align="left"><%#Eval("Title")%></td>
	                        <td align="center"><%#Eval("AlbumId")%></td>	                        
	                        <td align="left"><%#Eval("Description")%></td>
	                        <td align="center">
                                <VIT:LinkSubmit ID="btnOrderUp" Function="Album_Modify" OnClick="updateOrder_Click" CssClass="btn" runat="server" Param='<%#Eval("Id")+"|-"%>'><img src="<%=URLRoot %>Admin/Includes/icons/uparrow.png"/></VIT:LinkSubmit>
                                <span><%#Eval("Orders")%></span>
                                <VIT:LinkSubmit ID="btnOrderDown" Function="Album_Modify" OnClick="updateOrder_Click" CssClass="btn" runat="server" Param='<%#Eval("Id")+"|+"%>'><img src="<%=URLRoot %>Admin/Includes/icons/downarrow.png"/></VIT:LinkSubmit>
                            </td>
	                        <td align="center">
                                <VIT:LinkSubmit ID="changePublish" Function="Album_Modify" OnClick="changePublish_Click" runat="server" Param='<%#Eval("Id")+"|"+Eval("Published")%>'>
                                    <img alt="<%#Eval("Published")%>" src="<%#URLRoot+(Eval("Published").ToString() == "True" ? "Admin/Includes/icons/tick.png" : "Admin/Includes/icons/publish_x.png")%>" />
                                </VIT:LinkSubmit>
                            </td>
		                    <td align="center"><%#Eval("id")%></td>	
                            <td align="center"><a href='VideoEdit.aspx?sId=<%#Eval("id")%>'>Sửa</a></td>
                        </tr>
                    </ItemTemplate> 
                </asp:ListView>
            </table>
        </div>
    </form>
    <script type="text/javascript">
        $("#aside ul li#VideoList").addClass("submenu-active");
    </script>
</asp:Content>
